package com.wn.icloud.provider.demo.rpc;

import com.wn.icloud.provider.demo.dto.DemoFeignDTO;
import com.wn.icloud.provider.demo.remote.DemoFeignApi;
import com.wn.icloud.provider.demo.service.DemoService;
import com.wn.icloud.provider.demo.service.mapper.DemoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zhq
 * @datetime: 2020/4/24 20:34
 * @description: TODO
 */
@RequestMapping("/")
@RestController
public class DemoRest implements DemoFeignApi {

    @Autowired
    private DemoService demoService;

    @Autowired
    private DemoMapper demoMapper;

    @Override
    public DemoFeignDTO getDemos(Integer id) {
        return demoMapper.toDto(demoService.queryById(id));
    }
}
